home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / gcc / geninline_920614.lha / inline-2.0 / disk.h < prev    next >
C/C++ Source or Header  |  1992-06-14  |  2KB  |  102 lines

  1. #ifndef _INLINE_DISK_H
  2. #define _INLINE_DISK_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct DiskBase*  DiskBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME DiskBase
  18. #endif
  19.  
  20. static __inline BOOL 
  21. AllocUnit (BASE_PAR_DECL long unitNum)
  22. {
  23.   BASE_EXT_DECL
  24.   register BOOL  _res  __asm("d0");
  25.   register struct DiskBase* a6 __asm("a6") = BASE_NAME;
  26.   register long d0 __asm("d0") = unitNum;
  27.   __asm __volatile ("jsr a6@(-0x6)"
  28.   : "=r" (_res)
  29.   : "r" (a6), "r" (d0)
  30.   : "a0","a1","d0","d1");
  31.   return _res;
  32. }
  33. static __inline void 
  34. FreeUnit (BASE_PAR_DECL long unitNum)
  35. {
  36.   BASE_EXT_DECL
  37.   register struct DiskBase* a6 __asm("a6") = BASE_NAME;
  38.   register long d0 __asm("d0") = unitNum;
  39.   __asm __volatile ("jsr a6@(-0xc)"
  40.   : /* no output */
  41.   : "r" (a6), "r" (d0)
  42.   : "a0","a1","d0","d1");
  43. }
  44. static __inline struct DiskResourceUnit *
  45. GetUnit (BASE_PAR_DECL struct DiskResourceUnit *unitPointer)
  46. {
  47.   BASE_EXT_DECL
  48.   register struct DiskResourceUnit * _res  __asm("d0");
  49.   register struct DiskBase* a6 __asm("a6") = BASE_NAME;
  50.   register struct DiskResourceUnit *a1 __asm("a1") = unitPointer;
  51.   __asm __volatile ("jsr a6@(-0x12)"
  52.   : "=r" (_res)
  53.   : "r" (a6), "r" (a1)
  54.   : "a0","a1","d0","d1");
  55.   *(char *)a1 = *(char *)a1;
  56.   return _res;
  57. }
  58. static __inline LONG 
  59. GetUnitID (BASE_PAR_DECL long unitNum)
  60. {
  61.   BASE_EXT_DECL
  62.   register LONG  _res  __asm("d0");
  63.   register struct DiskBase* a6 __asm("a6") = BASE_NAME;
  64.   register long d0 __asm("d0") = unitNum;
  65.   __asm __volatile ("jsr a6@(-0x1e)"
  66.   : "=r" (_res)
  67.   : "r" (a6), "r" (d0)
  68.   : "a0","a1","d0","d1");
  69.   return _res;
  70. }
  71. static __inline void 
  72. GiveUnit (BASE_PAR_DECL0)
  73. {
  74.   BASE_EXT_DECL
  75.   register struct DiskBase* a6 __asm("a6") = BASE_NAME;
  76.   __asm __volatile ("jsr a6@(-0x18)"
  77.   : /* no output */
  78.   : "r" (a6)
  79.   : "a0","a1","d0","d1");
  80. }
  81. static __inline LONG 
  82. ReadUnitID (BASE_PAR_DECL long unitNum)
  83. {
  84.   BASE_EXT_DECL
  85.   register LONG  _res  __asm("d0");
  86.   register struct DiskBase* a6 __asm("a6") = BASE_NAME;
  87.   register long d0 __asm("d0") = unitNum;
  88.   __asm __volatile ("jsr a6@(-0x2a)"
  89.   : "=r" (_res)
  90.   : "r" (a6), "r" (d0)
  91.   : "a0","a1","d0","d1");
  92.   return _res;
  93. }
  94. #undef BASE_EXT_DECL
  95. #undef BASE_PAR_DECL
  96. #undef BASE_PAR_DECL0
  97. #undef BASE_NAME
  98.  
  99. __END_DECLS
  100.  
  101. #endif /* _INLINE_DISK_H */
  102.